package com.kude.manager;

import com.kude.dao.ProductDAO;
import com.kude.entity.Product;
import com.kude.util.BeanFactory;


public class ProductManager extends AbstractManager<Product,ProductDAO>{

	ProductDAO productDAO;
	public ProductManager() {
		this.tableName = Product.TABLE_NAME;
	}

	public boolean isExist(Product obj) throws OperException {
		if(obj == null) {
			throw new OperException("产品对象obj不能为空");
		}
		if(obj.getProductId() == null) {
			return false;
		}
		if(dao.getById(obj.getProductId()) == null) {
			return false;
		}
		return true;
	}
	
	public void setProductDAO(ProductDAO productDAO) {
		this.dao = productDAO;
	}

}
